\(\int (a \cos (x)+b \sin (x)) \, dx\) [4]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 9, antiderivative size = 10 \[ \int (a \cos (x)+b \sin (x)) \, dx=-b \cos (x)+a \sin (x) \]

[Out]

-b*cos(x)+a*sin(x)

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.222, Rules used = {2717, 2718} \[ \int (a \cos (x)+b \sin (x)) \, dx=a \sin (x)-b \cos (x) \]

[In]

Int[a*Cos[x] + b*Sin[x],x]

[Out]

-(b*Cos[x]) + a*Sin[x]

Rule 2717

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 2718

Int[sin[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Cos[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = a \int \cos (x) \, dx+b \int \sin (x) \, dx \\ & = -b \cos (x)+a \sin (x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.05 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.00 \[ \int (a \cos (x)+b \sin (x)) \, dx=-b \cos (x)+a \sin (x) \]

[In]

Integrate[a*Cos[x] + b*Sin[x],x]

[Out]

-(b*Cos[x]) + a*Sin[x]

Maple [A] (verified)

Time = 0.16 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.10

method result size
default \(-b \cos \left (x \right )+a \sin \left (x \right )\) \(11\)
risch \(-b \cos \left (x \right )+a \sin \left (x \right )\) \(11\)
parts \(-b \cos \left (x \right )+a \sin \left (x \right )\) \(11\)
parallelrisch \(a \sin \left (x \right )-b \cos \left (x \right )-b\) \(14\)
meijerg \(a \sin \left (x \right )+b \sqrt {\pi }\, \left (\frac {1}{\sqrt {\pi }}-\frac {\cos \left (x \right )}{\sqrt {\pi }}\right )\) \(22\)
norman \(\frac {2 a \tan \left (\frac {x}{2}\right )-2 b}{1+\tan \left (\frac {x}{2}\right )^{2}}\) \(23\)

[In]

int(a*cos(x)+b*sin(x),x,method=_RETURNVERBOSE)

[Out]

-b*cos(x)+a*sin(x)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.00 \[ \int (a \cos (x)+b \sin (x)) \, dx=-b \cos \left (x\right ) + a \sin \left (x\right ) \]

[In]

integrate(a*cos(x)+b*sin(x),x, algorithm="fricas")

[Out]

-b*cos(x) + a*sin(x)

Sympy [A] (verification not implemented)

Time = 0.03 (sec) , antiderivative size = 8, normalized size of antiderivative = 0.80 \[ \int (a \cos (x)+b \sin (x)) \, dx=a \sin {\left (x \right )} - b \cos {\left (x \right )} \]

[In]

integrate(a*cos(x)+b*sin(x),x)

[Out]

a*sin(x) - b*cos(x)

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.00 \[ \int (a \cos (x)+b \sin (x)) \, dx=-b \cos \left (x\right ) + a \sin \left (x\right ) \]

[In]

integrate(a*cos(x)+b*sin(x),x, algorithm="maxima")

[Out]

-b*cos(x) + a*sin(x)

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.00 \[ \int (a \cos (x)+b \sin (x)) \, dx=-b \cos \left (x\right ) + a \sin \left (x\right ) \]

[In]

integrate(a*cos(x)+b*sin(x),x, algorithm="giac")

[Out]

-b*cos(x) + a*sin(x)

Mupad [B] (verification not implemented)

Time = 20.98 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.00 \[ \int (a \cos (x)+b \sin (x)) \, dx=a\,\sin \left (x\right )-b\,\cos \left (x\right ) \]

[In]

int(a*cos(x) + b*sin(x),x)

[Out]

a*sin(x) - b*cos(x)